﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
using Npgsql;
using SmartRS.com.vn.smartrs.form.account;
using NHibernate.Cfg;
using NHibernate.Tool.hbm2ddl;
using SmartRS.com.vn.smartrs.form.menu;
using SmartRS.com.vn.smartrs.form.config;
using SmartRS.com.vn.smartrs.config;
using SmartRS.com.vn.smartrs.util;

namespace SmartRS
{
    static class Program
    {
        private static bool isShow = false;
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            /*bool error = false;
            //Read config
            InitConfig.readConfig();
            //Check config value
            if (InitConfig.checkConfig())
            {
                if (!InitConfig.checkDbConnection(Config.dbServer, Config.dbName, Config.dbUser, Config.dbPassword))
                {
                    error = true;
                }
            }
            else
            {
                error = true;
            }
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            if(error)
            {
                frmConfig frm = new frmConfig();
                frm.setConfigValue(Config.logPath, Config.dbServer, Config.dbName, Config.dbUser, Config.dbPassword,
                    Config.restaurantName, Config.restaurentAddress, Config.restaurantPhone);

                frm.getResult += getResult;
                Application.Run(frm);

                if(isShow)
                {
                    Application.Run(new frmMain());
                }
            }
            else
            {
                Application.Run(new frmMain());
            }*/
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new frmMain());
        }

        private static void getResult(bool result)
        {
            if (result)
            {
                isShow = true;
            }
        }
    }
}
